/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.beans.cargas.threading;

import net.easoftware.code.dao.CargasDao;
import net.easoftware.code.error.EaError;
import org.apache.log4j.Logger;

/**
 *
 * @author Eliu
 */
public class CargasValidatorProcess extends Thread {

    static final Logger lg = Logger.getLogger(CargasValidatorProcess.class.getName());
    private CargasDao dao;
    private boolean running;
    private boolean executed = false;
    private String tipoValidacion;

    public String getTipoValidacion() {
        return tipoValidacion;
    }

    public void setTipoValidacion(String tipoValidacion) {
        this.tipoValidacion = tipoValidacion;
    }

    public boolean isExecuted() {
        return executed;
    }

    public void setExecuted(boolean executed) {
        this.executed = executed;
    }

    public boolean isRunning() {
        return running;
    }

    public void setRunning(boolean running) {
        this.running = running;
    }

    public CargasDao getDao() {
        return dao;
    }

    public void setDao(CargasDao dao) {
        this.dao = dao;
    }

    @Override
    public void run() {
        try {
            running = true;
            dao.validarDatosCarga(tipoValidacion);
            dao.deleteDatosInvalidos();
        }
        catch (EaError ex) {
            lg.error(ex);
        }
        executed = true;
        running = false;
    }
}
